from api.base import BaseAdminApi
from common.encry_decry import md5
from common.file_load import read_yml


class ManagerApi(BaseAdminApi):
    """管理员登录接口"""
    def __init__(self, username, password):
        super().__init__()
        self.url = f"{self.host}/admin/systems/admin-users/login"
        self.method = "get"
        self.params = {
            "username": username,
            "password": md5(password),
            "captcha": read_yml("/config/common.yml")["captcha"],
            "uuid": "jdajhjakd"
        }


class ManagerAudit(BaseAdminApi):
    """管理员批量审核商品"""
    def __init__(self,goods_ids:list):
        super().__init__()
        self.url = f"{self.host}/admin/goods/batch/audit"
        self.method = "post"
        self.json = {
            "goods_ids": goods_ids,
            "message": "通过",
            "pass": 1
            }

